/*
 * kdtree_viewer.h
 *
 *  Created on: May 1, 2011
 *      Author: tqlong
 */

#ifndef KDTREE_VIEWER_H_
#define KDTREE_VIEWER_H_
#include "viewer.h"
#include "../data/dataset.h"
#include "../tree/kdtree.h"

class KDTreeViewer : public Viewer
{
  typedef InMemoryDataset      dataset_type;
  typedef KDTree<dataset_type> tree_type;
  std::string m_inName, m_outName;
  std::string m_format;
  dataset_type *m_data;
  tree_type *m_tree;
public:
  KDTreeViewer(const std::string& inName, const std::string& outName, const std::string& format);
  void plot(Plotter& pl); // derived classes reimplement this method
  void reload();
};

class KNNViewer : public  Viewer
{
  typedef InMemoryDataset        dataset_type;
  typedef std::vector<int>       vint_type;
  typedef dataset_type::vec_type vec_type;
  std::string m_inName, m_outName, m_qName;
  std::string m_format;
  bool m_number;
  dataset_type m_inData, m_qData;
  std::vector<vint_type  > m_nnIdx;
public:
  KNNViewer(const std::string& inName, const std::string& qName, const std::string& outName, const std::string& format,
            bool number = false);
  void plot(Plotter& pl); // derived classes reimplement this method
  void reload();
};

#endif /* KDTREE_VIEWER_H_ */
